package com.zrf.testchatgpt.shiro.token;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.HostAuthenticationToken;
import org.apache.shiro.authc.RememberMeAuthenticationToken;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginToken implements HostAuthenticationToken, RememberMeAuthenticationToken {

    private   String wxName;
    private String openid;
    private Boolean rememberMe = false;

    private String host;

    public LoginToken(final String wxName, String openid) {
        this.wxName=wxName;
        this.openid=openid;
        this.host=null;
    }

    @Override
    public boolean isRememberMe() {
        return rememberMe;
    }

    @Override
    public Object getPrincipal() {
        return getWxName();
    }

    @Override
    public Object getCredentials() {
        return getOpenid();
    }

    @Override
    public String getHost() {
        return host;
    }
}
